package com.spring.cloud.consume.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.spring.cloud.consume.service.ConsumeService;
import com.spring.cloud.consume.service.FeignProvideService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/consume")
public class ConsumeController {
    public Logger log = LoggerFactory.getLogger(this.getClass());
    @Autowired
    ConsumeService consumeService;
   /*
    @Value("${config.author}")
    String author;
    @RequestMapping("/config")
    public String config(){
        log.info("========ribbon========= hi" +author);
        return author;
    }*/

    /**
     * feign 调用
     * @param name
     * @return
     */
    @RequestMapping("/feign")
    public String fegin(@RequestParam("name") String name){
        return consumeService.feign(name);
    }


    @RequestMapping("/hystrix")
    public String hystrix(@RequestParam String name){
        return consumeService.hystrix(name);
    }



    /***
     *   restTemplate 调用
     * @param name
     * @return
     */
    @RequestMapping("/ribbon")
    public String ribbon(@RequestParam("name") String name){
        log.info("========ribbon========= hi" +name);
        return consumeService.ribbon(name);
    }



}
